{extend name='admin@main'}

{block name="button"}

{if auth("add")}
<button data-open='{:url("add")}' data-title="新增工单" class='layui-btn layui-btn-sm layui-btn-primary'>新增工单</button>
{/if}
<a class="layui-btn layui-btn-sm layui-btn-normal" href='{:url("export",["customer"=>$Think.get.customer,"status"=>$Think.get.status,"limit"=>$Think.get.limit,"page"=>$Think.get.page])}' target="_blank">导出本页</a>
{/block}
{block name="content"}
<div class="think-box-shadow">
    {include file='personal/index_search'}
    <table class="layui-table" lay-skin="line" width="100%">
        {notempty name='list'}
        <colgroup>
            <col width="50">
            <col width="100">
            <col width="90">
            <col width="70">
            <col width="70">
            <col>
            <col width="70">
            <col width="150">
            <col width="250">
            <col>
          </colgroup>
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='text-left nowrap'>客户名称</th>
            <th class='text-left nowrap'>联系人</th>
            <th class='text-center nowrap'>工单等级</th>
            <th class='text-left nowrap'>工单分类</th>
            <th class='text-left nowrap'>工单标题</th>
            <th class='text-left nowrap'>工单状态</th>
            <th class='text-left nowrap'>工单日期</th>
            <th class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.work_id}' type='checkbox'></label>
            </td>
            <td class='text-left nowrap'>
                {$Think.config.customer[$vo.customer]}
            </td>
            <td class='text-left nowrap'>{$vo.contact_people|default='-'}</td>
            <td class='text-center nowrap'>
                {$Think.config.case_grade[$vo.grade]}
            </td>
            <td class='text-left nowrap'>
                {$Think.config.case_category[$vo.categroy]}
            </td>
            <td class='text-left nowrap'>{$vo.work_desc}</td>
            <td class='text-left nowrap'>
                {if $vo.work_status eq 0}
                <span class="layui-badge">未解决</span>
                {/if}
                {if $vo.work_status eq 1}
                <span class="layui-badge layui-bg-orange">延期</span>
                {/if}
                {if $vo.work_status eq 2}
                <span class="layui-badge layui-bg-blue">已解决</span>
                {/if}
            </td>
            <td class='text-left nowrap'>{$vo.work_start}</td>
            <td class='text-left nowrap'>
                <a class="layui-btn layui-btn-sm layui-bg-cyan" data-open='{:url("info")}?work_id={$vo.work_id}' data-csrf="{:systoken('state')}">查看</a>
                {if auth("edit") and $vo.work_status neq 2}
                <a data-dbclick class="layui-btn layui-btn-sm" data-title="修改工单" data-open='{:url("edit")}?work_id={$vo.work_id}'>修 改</a>
                {/if}

                {if auth("delete") and $vo.work_status neq 2}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该工单吗？" data-action="{:url('remove')}" data-value="work_id#{$vo.work_id}" data-csrf="{:systoken('remove')}">删 除</a>
                {/if}

                {if auth("state") and $vo.work_status eq 1 }
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="work_id#{$vo.work_id};work_status#0" data-csrf="{:systoken('state')}">未  解  决</a>
                <a class="layui-btn layui-btn-sm layui-btn-normal" data-action="{:url('state')}" data-value="work_id#{$vo.work_id};work_status#2" data-csrf="{:systoken('state')}">已解决</a>
                {/if}
                {if auth("state") and $vo.work_status eq 0 }
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="work_id#{$vo.work_id};work_status#1" data-csrf="{:systoken('state')}">延期解决</a>
                <a class="layui-btn layui-btn-sm layui-btn-normal" data-action="{:url('state')}" data-value="work_id#{$vo.work_id};work_status#2" data-csrf="{:systoken('state')}">已解决</a>
                {/if}
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>

{/block}
